﻿<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>主页</title>
  <script>
    let pages = {
      utils: {
        name: '工具',
        list: [
          { url: 'random_seating', name: '随机排座位' },
          { url: 'baidu_tts', name: '百度语音合成' },
          { url: 'crafting_helper', name: '粘液科技合成助手' },
          { url: 'brainfuck_interpreter', name: 'brainfuck解释器' },
          { url: 'polynomial_calculator', name: '多项式计算器' },
          { url: 'lisp_interpreter', name: 'lisp解释器' },
        ]
      },
      games: {
        name: '小游戏',
        list: [
          { url: 'ten_drops', name: '十滴水' },
          { url: 'gomoku', name: '五子棋' },
          { url: 'werewolf_dealer', name: '狼人杀发牌器' },
          { url: 'rotating_face_text', name: '旋转颜文字' },
        ]
      }
    }

    window.onload = () => {
      let footer = document.body.firstChild;
      for (let typeId in pages) {
        let type = pages[typeId];
        let title = document.createElement('h2');
        title.innerHTML = type.name;
        document.body.insertBefore(title, footer);
        let list = document.createElement('p');
        for (let { url, name } of type.list) {
          let a = document.createElement('a');
          a.href = `${typeId}/${url}/index.html`;
          a.innerHTML = name + '<br />';
          list.appendChild(a);
        }
        document.body.insertBefore(list, footer);
      }
    }
  </script>
</head>

<body>
  <footer>
    Copyright &copy FLYC飘云 2020
  </footer>
</body>

</html>
